<template>
	<view class="content">
		<view class="bag">
			<view class="header">
				<view class="denglu">登录</view>
				<input type="text" placeholder="请输入账号" class="zh" v-model="account">
				<view class="header_a flexbetween">
					<input type="password" placeholder="请输入密码" class="mm" v-model="password">
				</view>
				<view class="bigbtn margin_top6" @click="login">登录</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				account: "",
				password: "",
			}
		},
		onLoad() {

		},
		methods: {
			login() {

				let _this = this;
				if (_this.account == '') {
					httpRequest.toast("请输入账号!")
					return;
				}
				if (_this.password == '') {
					httpRequest.toast("请输入密码!")
					return;
				}
				uni.showLoading({
					mask: true,
					title: "请稍候"
				})
				httpRequest.request('/api/user/login', 'GET', {
					account: this.account,
					password: this.password
				}).then(res => {
					uni.hideLoading()
					if (res.code == 1) {
						uni.clearStorageSync();
						uni.setStorageSync('token', res.data.userinfo.token);
						uni.setStorageSync('user_id', res.data.userinfo.user_id);
						httpRequest.toast('登录成功');
						setTimeout(() => {
							uni.reLaunch({
								url: "/pages/index/index"
							})
						}, 1000)
					}else{
						httpRequest.toast(res.msg);
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	input {
		height: inherit;
	}

	.img {
		width: 28rpx;
		height: 20.36rpx;
	}

	.huoqu {
		font-size: 30rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #F3271C;
		margin-right: 14rpx;
		min-width: 200rpx;
		text-align: right;
	}

	.orange {
		color: rgba(243, 39, 28, 1);
	}

	.bag {
		width: 100%;
		height: 100vh;
		background-size: 100% 100%;
		background-image: url("../../static/system/login_bg.png");
	}

	.header_a {
		border-bottom: 1rpx solid rgba(153, 153, 153, 0.10);
	}

	.content {
		background-color: #ffffff;
		min-height: 80vh;
	}

	.header {
		padding: 0rpx 30rpx;
	}

	.denglu {
		padding-top: 208rpx;
		font-size: 40rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #000000;
	}

	input:input-placeholder {
		color: #999999;
	}

	.zh {
		margin-top: 86rpx;
		padding-bottom: 28rpx;
		border-bottom: 1rpx solid rgba(153, 153, 153, 0.10);
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
	}

	.mm {
		flex: 1;
		margin-top: 44rpx;
		border-bottom: 1rpx solid rgba(153, 153, 153, 0.10);
		padding-bottom: 45rpx;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
	}

	.yue {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
		margin-top: 71rpx;
		margin-left: 10rpx;
		margin-right: 8rpx;
	}

	.dui {
		width: 26rpx;
		height: 26rpx;
		margin-right: 7rpx;
	}

	.dui1 {
		width: 23rpx;
		height: 23rpx;
		margin-right: 7rpx;
		border: 1rpx solid #999;
		border-radius: 50%;
	}

	.dl {
		margin-left: 10rpx;
		margin-right: 8rpx;
		margin-top: 30rpx;
		width: 672rpx;
		height: 82rpx;
		background-color: rgba(243, 39, 28, 1);
		font-size: 32rpx;
		border-radius: 41rpx 41rpx 41rpx 41rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		line-height: 82rpx;
		text-align: center;
	}

	.otherBox {
		margin-top: 171rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.otherBoxTop {
		display: flex;
		align-items: center;

		.line {
			width: 38rpx;
			height: 0rpx;
			border: 1rpx solid #CCCCCC;
		}

		.text {
			font-size: 24rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #999999;
		}
	}

	.otherBoxBottom {
		margin-top: 68rpx;
		display: flex;
		justify-content: center;
		text-align: center;

		image {
			width: 76rpx;
			height: 76rpx;
		}

		.weixin {
			margin-right: 126rpx;
		}

		.text {
			font-size: 24rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #000000;
			margin-top: 20rpx;
		}

	}
</style>